/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package com.timesheet.gui.forms;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.part.ViewPart;

public class FormView extends ViewPart {
	private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
	private ScrolledForm scrolledForm;
	private Form form;
	private Composite composite ;
	
	/**
	 * The constructor.
	 */
	public FormView() {
	}
	/**
	 * This is a callback that will allow us to create the viewer and
	 * initialize it.
	 */
	public void createPartControl(Composite parent) {
		
		this.composite = parent ;
		//scrolledForm = toolkit.createScrolledForm(parent);		
		form = toolkit.createForm(parent);	
		toolkit.paintBordersFor(form.getBody());
		//toolkit.paintBordersFor(scrolledForm.getBody());
	}
	public Form getForm() {
		return form;
	}
	
	/**
	 * Passing the focus request to the form.
	 */
	public void setFocus() {
		
		scrolledForm.setFocus();
	}
	
	public FormToolkit getToolkit() {
		return toolkit;
	}
	
	protected Composite createComposite(Composite parent,int style){
		return getToolkit().createComposite(parent,style);
	}
	
	public ScrolledForm getScrolledForm() {
		return scrolledForm;
	}
	/**
	 * Disposes the toolkit
	 */
	public void dispose() {
		toolkit.dispose();
		super.dispose();
	}
}